home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / FAQ.SWG / 0038_SEC14-BORLAND.pas < prev    next >
Pascal/Delphi Source File  |  1995-02-28  |  2KB  |  57 lines

  1. SECTION 14 - Windows API
  2.  
  3. This document contains information that is most often provided
  4. to users of this section.  There is a listing of common
  5. Technical Information Documents that can be downloaded from the
  6. libraries, and a listing of the five most frequently asked
  7. questions and their answers.
  8.  
  9. TI607    How to print in windows.  
  10.  
  11. Q.   "How can I enable or disable a particular control in a
  12.      dialog box?"
  13.  
  14. A.   Use the EnableWindow(Wnd: Hwnd, Enable: Bool) API function. 
  15.      It takes two parameters, the handle to the window (remember
  16.      a control is a window) to be enabled/disabled and a boolean
  17.      value - True for enable and False for disable.
  18.  
  19. Q.   "How do I obtain the handle or ID of a control?" 
  20.  
  21. A.   If you have a pointer to a control object, OWL will give you
  22.      the window handle automatically through the HWindow field; 
  23.      PointerToMyControl^.HWindow is the window handle.
  24.  
  25.      If you know the handle of a control, you can obtain the ID
  26.      by calling the GetDlgCtrlID() API function:
  27.  
  28.         ControlID := GetDlgCtrlID(ControlHandle);
  29.  
  30.      If you don't have a pointer to your control, but know the ID
  31.      of a control, you can obtain the handle by calling the
  32.      GetDlgItem() API function:
  33.  
  34.         ControlHandle := GetDlgItem(DialogHandle, ControlID);
  35.  
  36. Q.   "How do I unload an abnormally terminated program's dlls?"
  37.  
  38. A.   By using GetModuleHandle to return the dll's handle, and
  39.      then call freelibrary until GetModuleHandle returns 0.  If a
  40.      dll has loaded another dll, unload the child dll first.
  41.  
  42. Q.   "How do I hide a minimized icon without taking the program
  43.      off the task list?"
  44.  
  45. A.   Move the icon off the display using SetWindowPos or
  46.      MoveWindow and give negative coordinate values beyond the
  47.      screen.
  48.  
  49. Q.   "How do I change a dll's data segment from fixed to
  50.      movable?"
  51.  
  52. A.   Call GlobalPageUnloch(DSEG) in the outer block of your dll. 
  53.      This will work providing the dll does not contain code that
  54.      requires a page locked data segment.
  55.  
  56.  
  57.